#------------------------------------------------------------------------------
# Project:     Multi-Programmer Game Demo
# Name:        Ball.py
# Purpose:     Bouncing Ball Object
# 
# Authors:     bailey robinson
# Main Author: bailey robinson
#
# Created:     11/30/2012
# Copyright:   (c) bailey robinson 2013
# Licence:     New BSD
# minus 2 points form help getting code
# minus 2 for help with smartgit
#------------------------------------------------------------------------------
import pygame, math, sys, random

class Ball():
    def __init__(self, speed, position, screenSize):
        self.surfaces = []
        self.surfaces += [pygame.image.load("rsc/Ball/Ball1-1.png")]
        self.surfaces += [pygame.image.load("rsc/Ball/Ball1-2.png")]
        self.frame = 0
        self.maxFrame = len(self.surfaces)-1
        self.surface = self.surfaces[self.frame]
        self.rect = self.surface.get_rect()
        self.radius = self.rect.width/2
        self.speed = [0,0]
        self.screenWidth = screenSize[0]
        self.screenHeight = screenSize[1]
        self.place(position)
        self.living = True
        if pygame.mixer:
            self.bounceSound = pygame.mixer.Sound("bounce.wav")
        
    def  __str__(self):
        return "I'm a Ball " + str(self.rect.center) + str(self.speed) + str(self.living)
     
    def place(self, position):
        print "I've moved to", position
        
    def move(self):
        self.rect = self.rect.move(self.speed) 
        print "I've moved", self.speed
        
    def collideFloor(self, screenHeight):
        print "trying to hit bottom of screen", screenHeight
    
    def collideWall(self, screenWidth, screenHeight):
        if (self.rect.left < 0 
            or self.rect.right > self.screenWidth):
            self.speed[o] = o
        if (self.rect.top < 0 
            or self.rect.bottom >self.screenHeight):
            self.speed[1] = 0
        print "trying to hit edges of screen", screenWidth, screenHeight
        
    def collidePaddle(self, paddle):
        print "trying to hit paddle", str(paddle)
        #if pygame.mixer:
        #   self.bounceSound.play()
        
    def collideBall(self, other):
        print "trying to hit ", str(other)